﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for DateTimeUtils
/// </summary>
public class DateTimeUtils
{
    public DateTimeUtils()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static DateTimeUtils Instance() 
    {
        return new DateTimeUtils();
    }
    public DateTime? ToDate(string date) 
    {
        try
        {
            return DateTime.ParseExact(date,"dd/MM/yyyy",null);
        }
        catch { } return null;
    }

    public static DateTime? yesterDays(int p)
    {
        return DateTime.Now.AddDays(p*-1);
    }
}
